package com.bwie.controller;

import com.bwie.common.domain.Student;
import com.bwie.common.remote.system.RemoteEsService;
import com.bwie.common.result.Result;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author：ShenJiaFeng
 * @Package：com.bwie.controller
 * @Project：zg5_19
 * @name：EsController
 * @Date：2024/2/18 14:24
 */
@RestController
@RequestMapping("/es")
public class EsController {
    private final RemoteEsService remoteEsService;

    public EsController(RemoteEsService remoteEsService) {
        this.remoteEsService = remoteEsService;
    }

    @PostMapping("/esList")
    public Result<List<Student>> studentList(){
        Result<List<Student>> listResult = remoteEsService.studentLists();
        List<Student> students = listResult.getData();
        return Result.success(students);
    }
}
